risc-v/gd32vw55x: wpa3 improvements#19461
Merged
Merged
Conversation
Associating to a WPA3 (SAE) network faulted inside the prebuilt vendor supplicant (load access fault in the elliptic-curve math of the SAE handshake, wifi_mgmt task). The port is WPA2-only, so refuse what the supplicant cannot complete: - Undefine CONFIG_WPA3_SAE in the build_config.h shim. This activates the vendor's own fallback in wifi_netlink.c: the SAE/OWE AKMs are stripped from the connection config and the SAE auth algorithm is never selected, so a WPA3-transition AP (WPA2/WPA3 mixed) now associates through WPA2-PSK. The flag only gates code, not struct layout, so the prebuilt libraries are unaffected. - Refuse an SAE/OWE/802.1X-only network up front in the connect path with ENOTSUP and a console message naming the unsupported AKM bitmap, instead of an obscure association failure. Validated on hardware (GD32VW553K-START), all three cases: a WPA2 network still associates (four-way handshake, DHCP, ping); a WPA2/WPA3 transition hotspot ([RSN:WPA-PSK,SAE CCMP/CCMP][MFP]) associates through WPA2-PSK, gets a lease and pings the gateway (it crashed before this change); and a WPA3-only hotspot is now refused with gdwifi: 'wpa3test' offers no supported AKM (bitmap 0x200): WPA3/SAE, OWE and 802.1X are not supported, WPA2-PSK only where it previously crashed. Assisted-by: Claude Opus 4.8 Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
A connection stops the legacy advertising set and the vendor stack leaves it stopped, so after the first central connected (or aborted the attempt) the device was never discoverable again until a reset. Register a connection callback and restart the advertising set with ble_adv_restart() on every disconnection event. This covers both the clean disconnect and the aborted-connection case: an incomplete connection holds the (single) link until the supervision timeout, and its disconnection event then restarts the advertising the same way. Validated on hardware (GD32VW553K-START): repeated scan/connect/write/disconnect cycles from a Linux central all find the device advertising again after the previous cycle, where it previously required a reset after the first connection. Assisted-by: Claude Opus 4.8 Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
acassis
requested review from
jerpelea,
linguini1,
raiden00pl and
xiaoxiang781216
July 16, 2026 23:46
acassis
previously approved these changes
Jul 16, 2026
CI builds with -Werror and the board's build carried thousands of warnings, all rooted in the vendor SDK integration: - The NMSIS riscv_encoding.h redefines 32 CSR macros that NuttX's <arch/csr.h> (pulled in through <nuttx/irq.h>) already defines with its own encodings. No -Wno flag covers macro redefinitions, so the SDK patch now undefines those names right before the NMSIS definitions. Same treatment for COMPILE_TIME_ASSERT in wifi_management.h. - The vendor sources are not NuttX-warning-clean (undefined macros in #if, %d for uint32_t, shadowed locals, K&R prototypes, ...); add the matching -Wno suppressions scoped to this chip's build. - Fix the port's own warnings properly: gd32vw55x_eclic.h redefined CSR_MINTSTATUS with the Nuclei address (0x346) over the standard CLIC one in csr.h (renamed to CSR_NUCLEI_MINTSTATUS), an unused variable in gdwifi_transmit() and a dead function in wrapper_nuttx.c. All seven configurations now build with "-Wno-cpp -Werror" (the CI flags). Smoke-validated on hardware: Wi-Fi WPA2 association and ping, BLE advertising, connect and GATT write. Assisted-by: Claude Opus 4.8 Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
JorgeGzm
force-pushed
the
gd32vw553-wpa3-reject
branch
from
July 17, 2026 02:09
35e6c95 to
3ccf149
Compare
xiaoxiang781216
approved these changes
Jul 17, 2026
jerpelea
approved these changes
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two robustness fixes for the GD32VW553 port:
1. Reject WPA3/SAE networks instead of crashing. Associating to a WPA3
(SAE) network faulted inside the prebuilt vendor supplicant (load access
fault in the elliptic-curve math of the SAE handshake). The port is
WPA2-only, so refuse what the supplicant cannot complete:
CONFIG_WPA3_SAEin thebuild_config.hshim. This activatesthe vendor's own fallback in
wifi_netlink.c: the SAE/OWE AKMs arestripped from the connection config and the SAE auth algorithm is never
selected, so a WPA3-transition AP (WPA2/WPA3 mixed) now associates
through WPA2-PSK. The flag only gates code, not struct layout, so the
prebuilt libraries are unaffected.
ENOTSUPand a console message naming the unsupported AKM bitmap,instead of an obscure association failure.
2. Restart BLE advertising after disconnection. A connection stops the
legacy advertising set and the vendor stack leaves it stopped, so after the
first central connected (or aborted the attempt) the device was never
discoverable again until a reset. Register a connection callback and
restart the advertising set with
ble_adv_restart()on everydisconnection. This covers both the clean disconnect and the
aborted-connection case (an incomplete connection holds the link until the
supervision timeout, whose disconnection event then restarts the
advertising the same way).
3. Make the build warning-clean for CI (-Werror). The board's build carried warnings rooted in the vendor SDK integration; they pre-date this PR (master carries them too) and CI surfaced them here because it builds with -Werror. The NMSIS riscv_encoding.h redefines 32 CSR macros that NuttX's <arch/csr.h> already defines with its own encodings, and no -Wno flag covers macro redefinitions, so the SDK patch now undefines those names right before the NMSIS definitions (same treatment for COMPILE_TIME_ASSERT in wifi_management.h). The remaining vendor-source warnings get matching -Wno suppressions scoped to this chip's build, and the port's own warnings are fixed properly: a CSR name in gd32vw55x_eclic.h that redefined the standard CLIC one, an unused variable and a dead function. Diagnostics only -- no behavior change
Impact
Only the GD32VW55x port (
arch/risc-v/src/gd32vw55xand its boarddocumentation); no common code is changed. Behavior changes:
crashed the supplicant).
ENOTSUPand a clear consolemessage (it previously crashed the supplicant).
required a reset after the first connection).
Testing
Built the
wapiandbleconfigurations;nxstyleis clean. Validatedon hardware (GD32VW553K-START).
1. WPA2 network (regression: still associates)
2. WPA3(SAE)-only network: refused with a clear error, no crash
Phone hotspot
wpa3testconfigured as WPA3-Personal (SAE only):(Before this change:
EXCEPTION: Load access faultin thewifi_mgmttask.
0x200is bit 9 =MAC_AKM_SAE. A refused connect also leaves apreviously established association untouched.)
3. WPA2/WPA3 transition network: associates through WPA2-PSK
Same hotspot switched to WPA2/WPA3 mixed mode; note the SAE AKM and MFP in
the beacon, and the plain WPA2 four-way handshake used:
(Before this change this case also crashed: the supplicant selected SAE
whenever the AP offered it.)
4. BLE: repeated connect cycles from a Linux central (bleak)
Scan / connect / write / disconnect cycles, no board reset in between:
Board console receives the writes:
(Before this change the device was no longer advertising after the first
connection and never became discoverable again until a reset.)